//
//  NetWork.h
//  BBT
//
//  Created by Monkxp on 15/9/6.
//  Copyright (c) 2015年 QCKJ. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

//get  block
typedef void(^AFNSuccessDataBlock)(id responseObj);

typedef void(^AFNFailDataBlock)(NSError *error);

// post block


typedef void(^PostSuccessBlock)(id responseObj);
typedef void(^PostFailBlock) (NSError *error);



/* 当请求成功后的 responseBlock */
typedef void (^responseBlock)(id responseObj);
/* 请求失败的时候 */
typedef void (^requestFailure)(NSError *error);
/* 图片上传成功 */
typedef void (^progressUpload)(int64_t totalSize, int64_t sendSize, NSDictionary *context,NSString *key);

@interface NetWork : NSObject


+(BOOL)netWorkStatus;

//+ (void)post:(NSString *)url params:(NSDictionary *)params success:(responseBlock)successHandler failure:(requestFailure)failureHandler;

+ (void)put:(NSString *)url params:(NSDictionary *)params success:(responseBlock)successHandler failure:(requestFailure)failureHandler;

+ (void)deleteRequest:(NSString *)url params:(NSDictionary *)params success:(responseBlock)successHandler failure:(requestFailure)failureHandler;

+(NSString *)compeletHttpUrlWithSubUrl1:(NSString *)subUrl;

//上传图片到百度云 COS
+(NSDictionary *)imagesUUID:(NSArray *)images;


//+ (void)get:(NSString *)url params:(NSDictionary *)params success:(responseBlock)successHandler failure:(requestFailure)failureHandler;

//拼接字典参数
+(NSString*)forDic:(NSDictionary*)dic;


+ (void)post:(NSString *)url params:(NSDictionary *)params success:(responseBlock)successHandler failure:(requestFailure)failureHandler;


+ (void)walletGetDataWithString:(NSString *)string parma:(NSDictionary *)parma SuccessBlock:(AFNSuccessDataBlock)succsessBlock FailBlock:(AFNFailDataBlock)failBlock;

+(void)walletPostDataWithString:(NSString *)string body:(NSDictionary *)parameters successBlock:(PostSuccessBlock)successBlock failBlock:(PostFailBlock)failBlock;

//add Get request

+ (void)getDataWithString:(NSString *)string parma:(NSDictionary *)parma SuccessBlock:(AFNSuccessDataBlock)succsessBlock FailBlock:(AFNFailDataBlock)failBlock;


// post request

+(void)postDataWithString:(NSString *)string body:(NSDictionary *)parameters successBlock:(PostSuccessBlock)successBlock failBlock:(PostFailBlock)failBlock;


//上传图片
+(void)uploadWithUrl:(NSString*)url Image:(UIImage *)image successBlock:(PostSuccessBlock)successBlock;


@end
